import chalk from 'chalk'
const Logger = process.stderr

/**
 * 打印使用方法
 * @param msg 信息
 */
export const getUse = (msg: string) => {
  const use = `Use: ${chalk.bold.redBright(msg)} [options] ${chalk.bold.red(
    '[./**/*.proto]'
  )} or ${chalk.bold.red('[./**/*.json] -t tagsName' )}`
  Logger.write(use)
}

export const getHelp = () => {
const helps = 
`Help:
${chalk.bold.green('--mock -m')}: open mock server, default is ${chalk.bold.red('false')};
${chalk.bold.green('--port -p')}: specify the path for generating the file, default is ${chalk.bold.red('./src/api')};
${chalk.bold.green('--port -js')}: generate the specified JS file, default is ${chalk.bold.red('false')};
${chalk.bold.green('--port -js')}: generate the specified TS file, default is ${chalk.bold.red('true')};
${chalk.bold.green('t')}: generate the target tags, default is ${chalk.bold.red('default')};
`
Logger.write(helps)
}

export const useLog = {
    info(msg: string) {
        Logger.write(`${chalk.bgGray(msg)}`)
    },
    err(msg: string) {
        Logger.write(`${chalk.bgRed(msg)}`)
    },
    success(msg: string) {
        Logger.write(`${chalk.bgGreen(msg)}`)
    }
}